<%@tag import="by.epam.communalservices.dao.jdbc.JdbcDaoJkhObject"%>
<%@tag import="by.epam.communalservices.entity.JkhObject"%>
<%@tag import="java.sql.Connection"%>
<%@ attribute name="id" required="true"%>

<%@ attribute name="owner"%>

<%
    Connection con = (Connection) request.getSession().getAttribute("currentConnection");
	JkhObject object = null;
	JdbcDaoJkhObject objectDao = new JdbcDaoJkhObject(con);
    if (getJspContext().getAttribute("id") != "" && Long.parseLong(getJspContext().getAttribute("id").toString()) > 0) {
        object = objectDao.read(Long.parseLong(getJspContext().getAttribute("id").toString()));
    }
    if (object!=null) {
        out.print(object.getId()+". <a href='object_edit?id="+object.getId()+"'>"+object.getSurname()+" "+object.getName()+"</a>");
        if (getJspContext().getAttribute("owner") != null) {
            request.setAttribute(getJspContext().getAttribute("owner").toString(), object.getIdOwner());
        }
    } else {
        if (getJspContext().getAttribute("owner") != null) {
            request.setAttribute(getJspContext().getAttribute("owner").toString(), "0");
        }
        out.print("-нет-");
    }
    
 %>